package com.extension.company.view.adapter;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.extension.company.admin.R;
import com.extension.company.model.entity.MessCenterListData;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 消息盒子的适配器
 */
public class MessCenterListAdapter extends BaseRecyclerAdapter<MessCenterListData,
		MessCenterListAdapter.Holder> {


	public MessCenterListAdapter(Context context, List<MessCenterListData> list) {
		super(context, list);
	}

	@Override
	public Holder onCreateViewHolder(ViewGroup parent, int viewType) {
		View view = mInflater.inflate(R.layout.messcenterlist_item, parent, false);
		return new Holder(view);
	}

	@Override
	public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
		super.onBindViewHolder(viewHolder, position);
		switch (position) {
			case 0:
				((Holder) viewHolder).messageHomeListItemIcon.setBackgroundResource(R.drawable.message_home_notificaton_icon);
				((Holder) viewHolder).tittle.setText("系统通知");

				break;
			case 1:
				((Holder) viewHolder).messageHomeListItemIcon.setBackgroundResource(R.drawable.message_home_activity_icon);
				((Holder) viewHolder).tittle.setText("推广活动");
				break;
			case 2:
				((Holder) viewHolder).messageHomeListItemIcon.setBackgroundResource(R.drawable.message_home_translation_icon);
				((Holder) viewHolder).tittle.setText("物流信息");
				break;
			default:
				break;
		}
	}

	@Override
	public int getItemCount() {
		return 3;
	}

	class Holder extends RecyclerView.ViewHolder {
		@BindView(R.id.message_home_list_item_icon)
		ImageView messageHomeListItemIcon;
		@BindView(R.id.layout_main)
		LinearLayout layoutMain;
		@BindView(R.id.item_title)
		TextView tittle;
		@BindView(R.id.item_content)
		TextView content;

		public Holder(View itemView) {
			super(itemView);
			ButterKnife.bind(this, itemView);
		}
	}
}
